/**
 * 新增
 */
var express = require("express");
var router = express.Router();

// 导入db ,操作数据库
const { getAll, getById, exec } = require("../db/index");
router.post("/", async (req, res) => {
  const { imgurl } = req.body;
  console.log(imgurl);
  // const { page = 1, size = 2 } = req.query;
  let sql = `insert into picture (picture)  values  ('${imgurl}')`;
  const data = await exec(sql);
  console.log(data);
  res.send({
    code: 0,
    message: "新增用户成功",
    result: {
      imgurl,
    },
  });
});

// 根据id获取

// 修改请求

// 删除

module.exports = router;
